import jieba
from variant import *

# 使用jieba进行分词
def segment_texts(texts):
    segmented_texts = []
    for text in texts:
        words = jieba.lcut(text)  # 使用精确模式进行分词
        segmented_texts.append(words)
    return segmented_texts

# 对所有分类进行分词
all_segmented_texts = []
for i in range(1, 17):
    variable_name = 'a' + str(i)  # 构造变量名
    texts = locals()[variable_name]  # 获取变量值
    segmented_texts = segment_texts(texts)
    all_segmented_texts.extend(segmented_texts)

